library(raster)
source('https://raw.githubusercontent.com/oharac/src/master/R/common.R')
source(here('common_fxns.R'))
library(animation)
reload <- FALSECreate a species richness map for threatened marine species.
Combine taxa-level impact maps to create maps of number of threatened species impacted per cell, per year.
Plot maps as animated rasters, both by absolute numbers of species impacted in a location and by proportion of species (impact counts / species richness).
This is all done at the level of cumulative impact category, not individual stressors.
Set up the dataframe of species to include. By taxon, load all species range maps, smash down to taxon-level species richness; then combine these for a total species richness.
Note that a priority sum map necessarily includes only species that are impacted; a species with no impacts, i.e. 0% of its range impacted, receives a priority of zero.
Are the two substantially different? This shows ratio calculated for each cell: \[\frac{\sum_{spp} \text{priority}}{\text{spp richness}}\] This is then normalized by dividing by the max value to get a range from 0-1.
Areas with high values represent concentrations of high priority species.
For each impact category (including all):
calc(fun = sum, na.rm = TRUE)These show impacts weighted by priority, divided by the total sum of spp priority present.